package oj;

/**
 * @author chaolong.jin
 * @description
 * @date 2019/08/26 22:11
 */
public class Kconvert {
    public static void main(String[] args) {
        Node head = new Node(0);
        for (int i = 1; i < 10; i++) {
            Node node = new Node(i);
            head.setNext(node);
            head = head.getNext();
        }
        int k = 3;
        Node list = head;
        while (list != null) {
            list.getNext();
        }
    }

    private static void kConvert(Node head, Node resultList, Node resultHead, int k) {
        int i = 0;
        Node convertList = new Node(head.value);
        while (i < k && head.next != null) {
            head = head.next;
            Node node = new Node(head.value);
            convertList.next = node;
            convertList = convertList.next;
            i++;
        }
        if (resultList == null) {
            resultHead = resultList = convertList;
        } else {
            resultList.next = convertList;
        }
        if (i < k) {
            return;
        }
        kConvert(head, convertList, resultHead, k);
    }
}
